package com.qpl.depression.cms.controller;


import com.qpl.depression.cms.common.ServerResponse;
import com.qpl.depression.cms.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

@Controller
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping("/file/upload")
    @ResponseBody
    public ServerResponse fileUpload(MultipartFile file) {
        return fileService.upload(file);
    }



    @PostMapping("/file/uploads")
    @ResponseBody
    public HashMap fileUploads(MultipartFile file) {
        return fileService.uploads(file);
    }
}
